package com.hospital.doctor.doctory.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.hospital.doctor.doctorg.entity.QueueEntity;
import com.hospital.doctor.doctory.dao.DrugRemedyMapper;
import com.hospital.doctor.doctory.dao.QueueMapper;
import com.hospital.doctor.doctory.entity.DoctorDiagnose;
import com.hospital.doctor.doctory.entity.DrugRemedy;
import com.hospital.doctor.doctory.service.QueueService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author ：ysb
 * @ClassName ：QueueServiceImpl
 * @Package ：com.hospital.doctor.doctory.service.impl
 * @Description:
 * @Date:2021/11/2 9:40
 */
@Service
public class QueueServiceImpl implements QueueService {

    @Autowired
    private QueueMapper queueDao;
    @Autowired
    private DrugRemedyMapper drugReMedYMApper;

    /**
     * 获取用户列表
     * @param doctorId 医生编号
     * @param state     用户状态
     * @return
     */
    @Override
    public List<QueueEntity> getList(Integer doctorId, Integer state,String riqi) {
        List<QueueEntity> list = queueDao.getList(doctorId, state,riqi);
        return list;
    }

    @Override
    public Boolean stateUpdate(int id) {
        Integer i = queueDao.stateUpdate(id);
        if (i != 0) {
            return true;
        }
        return false;
    }

    /**
     * 根据诊疗卡号查询用户过往病历
     * @param userid
     * @return
     */
    @Override
    public List<DoctorDiagnose> selectDiagnose(Integer userid) {
        return queueDao.selectDiagnose(userid);
    }

    /**
     * 查询出全部药品
     * @return
     */
    @Override
    public List<DrugRemedy> selectAll() {
        QueryWrapper<DrugRemedy> queryWrapper=new QueryWrapper<>();
        queryWrapper.select("id","drugname","utils");
        return drugReMedYMApper.selectList(queryWrapper);
    }


}
